﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.ComponentModel;
using System.Text;
using Global.Class.Library;


namespace DataTransferObject.MetaDataList
{
    public class ListStaffNameMaster : NotifyPropertyChangeObject
    {
        private int staffID;

        private DateTime entryDate;

        private int staffCategoryID;
        
        private string description;
        private string descriptionOfficial;
        private string descriptionOriginal;

        private bool inActive;

        public ListStaffNameMaster()
        {
            GlobalDefaultValue.Apply(this);
            this.EntryDate = DateTime.Now;
        }

        #region Properties


        [DefaultValue(-1)]
        public int StaffID
        {
            get { return this.staffID; }
            set { ApplyPropertyChange<ListStaffNameMaster, int>(ref this.staffID, o => o.StaffID, value); }
        }

        [DefaultValue(typeof(DateTime), "01/01/1900")]
        public DateTime EntryDate
        {
            get { return this.entryDate; }
            set { ApplyPropertyChange<ListStaffNameMaster, DateTime>(ref this.entryDate, o => o.EntryDate, value); }
        }

        //[DefaultValue(0)]
        public int StaffCategoryID
        {
            get { return this.staffCategoryID; }
            set { ApplyPropertyChange<ListStaffNameMaster, int>(ref this.staffCategoryID, o => o.StaffCategoryID, value); }
        }
       
        
        [DefaultValue("")]
        public string Description
        {
            get { return this.description; }
            set { ApplyPropertyChange<ListStaffNameMaster, string>(ref this.description, o => o.Description, value); }
        }

        [DefaultValue("")]
        public string DescriptionOfficial
        {
            get { return this.descriptionOfficial; }
            set { ApplyPropertyChange<ListStaffNameMaster, string>(ref this.descriptionOfficial, o => o.DescriptionOfficial, value); }
        }

        [DefaultValue("")]
        public string DescriptionOriginal
        {
            get { return this.descriptionOriginal; }
            set { ApplyPropertyChange<ListStaffNameMaster, string>(ref this.descriptionOriginal, o => o.DescriptionOriginal, value); }
        }
        

        [DefaultValue(false)]
        public bool InActive
        {
            get { return this.inActive; }
            set { ApplyPropertyChange<ListStaffNameMaster, bool>(ref this.inActive, o => o.InActive, value); }
        }
        
        #endregion

        protected override System.Collections.Generic.List<ValidationRule> CreateRules()
        {
            List<ValidationRule> validationRules = base.CreateRules();
            validationRules.Add(new SimpleValidationRule("Description", "Code cannot be blank.", delegate { return this.Description.Length != 0; }));
            validationRules.Add(new SimpleValidationRule("DescriptionOfficial", "Staffname cannot be blank.", delegate { return this.DescriptionOfficial.Length != 0; }));
            validationRules.Add(new SimpleValidationRule("StaffCategoryID", "Staff Category cannot be empty.", delegate { return this.StaffCategoryID > 0; }));
            
            return validationRules;
        }
    }
}
